#include "../process.h"
#include "../queue.h"
#include "../pqueue.h"
#include "../observer.h"
#include "../simulator.h"

#include <stdio.h>
#include <stdlib.h>


void queue_test(void);
void pqueue_test(void);

int main (int argc, char** argv)
{
	queue_test();
	//pqueue_test();
	return 0;
}

void queue_test(void)
{
	int i;
	struct qQueue *q = q_create();
	struct process *p;
	
	q = q_create();

	printf("Adding...\n");
	for(i=0; i<10; i++)
	{
		p = proc_create("Foo", i, i, i);
		proc_print(p);
		q_add(q, p);
	}

	printf("Removing...\n"); 
	while (!q_is_empty(q))
	{
		p = q_remove(q);
		proc_print(p);
	}
}

void pqueue_test(void)
{
	int i;
	struct pqueue *heap;
	struct process *p;

	heap = pq_create();

	for(i=0; i<100; i++)
	{
		p = proc_create("Foo", rand()%10, rand()%10, rand());
		proc_print(p);
		pq_insert(heap, p);
	}
		
	while(!pq_is_empty(heap))
		{proc_print(pq_remove(heap));}
}


int sim_get_clock()
{
	return 0;
}
